Call waypt_new instead of explicit calloc to prepare for external alt invalid
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 21 Mar 2005 15:01:04 +0000 (15:01 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 21 Mar 2005 15:01:04 +0000 (15:01 +0000)
indicator.

15 files changed:
gpsbabel/cetus.c
gpsbabel/copilot.c
gpsbabel/csv_util.c
gpsbabel/geoniche.c
gpsbabel/gpspilot.c
gpsbabel/gpsutil.c
gpsbabel/holux.c
gpsbabel/magnav.c
gpsbabel/mapopolis.c
gpsbabel/mapsend.c
gpsbabel/pcx.c
gpsbabel/psp.c
gpsbabel/tiger.c
gpsbabel/tmpro.c
gpsbabel/tpg.c

index 2e462fff2a049a560487094e8d8374261a870b3d..17927d0136ff05ff0d0ee049adf37c1896dce2c7 100644 (file)
@@ -165,7 +165,7 @@ data_read(void)
        for(pdb_rec = pdb->rec_index.rec; pdb_rec; pdb_rec=pdb_rec->next) {
                waypoint *wpt_tmp;
 
-               wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
+               wpt_tmp = waypt_new();
 
                rec = (struct record *) pdb_rec->data;
                if ( be_read32(&rec->elevation) == -100000000 ) {
index d55adb62f6f0debd829eb856d9f4606d75cc1ebe..787e5be43648949ee4efe4a911e2544dad9b1921 100644 (file)
@@ -88,7 +88,7 @@ data_read(void)
                waypoint *wpt_tmp;
                char *vdata;
 
-               wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
+               wpt_tmp = waypt_new();
 
                rec = (struct record *) pdb_rec->data;
                wpt_tmp->longitude =
index 64ae1edd56c917e24ac36fea66124310052fce0e..3b4fd28495cca8269d57c9ce1d669528a6a39f8e 100644 (file)
@@ -782,7 +782,7 @@ xcsv_data_read(void)
         }
 
         if (strlen(buff)) {
-            wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
+            wpt_tmp = waypt_new();
 
             s = buff;
             s = csv_lineparse(s, xcsv_file.field_delimiter, "", linecount);
index 69e22e8ca12e7d25e92d44891568f4826e431b4d..ff4a5a5d54c09e2d7b0c35207662666bbceb2d7e 100644 (file)
@@ -216,7 +216,7 @@ data_read(void)
        char            gid[6+1];
        struct tm       tm;
 
-       wpt = xcalloc(sizeof(*wpt), 1);
+       wpt = waypt_new();
        if (!wpt)
            fatal(MYNAME ": Couldn't allocate waypoint.\n");
        vdata = (char *) pdb_rec->data;
index 4bc70779877b097dc394c6358fed91d7b145f444..712b0e39230adbf328ff9709edb0167646b4d6d1 100644 (file)
@@ -122,7 +122,7 @@ data_read(void)
                waypoint *wpt_tmp;
                char *vdata;
 
-               wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
+               wpt_tmp = waypt_new();
 
                rec = (struct record *) pdb_rec->data;
                wpt_tmp->longitude = be_read32(&rec->longitude) / 3.6e6; 
index 1a56354b3a4c4ab63f0f3bedf058e873b930731d..4433a7fa1db26a97239b0e9c1d81ed8b0e40661f 100644 (file)
@@ -84,7 +84,7 @@ data_read(void)
                sscanf(&ibuf[70], "%2c", icon);
                rtrim(desc);
                rtrim(icon);
-               wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
+               wpt_tmp = waypt_new();
                wpt_tmp->altitude = alt;
                wpt_tmp->shortname = xstrdup(name);
                wpt_tmp->description = xstrdup(desc);
index 5b5d21efbaed1475e6459b882732b6531cd4d0b7..03613ff7f6a11c16c5b8549af89425e31fc6d9fe 100644 (file)
@@ -106,7 +106,7 @@ static void data_read(void)
     /* Get the waypoints */
     for (iCount = 0; iCount < iWptNum ; iCount ++)
     {
-        wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
+        wpt_tmp = waypt_new();
     
        iWptIndex = le_read16(&((WPTHDR *)HxWpt)->idx[iCount]);
         pWptHxTmp =  (WPT *)&HxWpt[OFFS_WPT + (sizeof(WPT) * iWptIndex)];
index ef9020bfa1ed9dcccc3275cd2315de1b5889a062..bc0a8183a48044debe076c0498a4da03f51bcb57 100644 (file)
@@ -106,7 +106,7 @@ data_read(void)
                struct tm tm;
 
                memset (&tm, sizeof(tm), 0);
-               wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
+               wpt_tmp = waypt_new();
                rec = (struct record *) pdb_rec->data;
                wpt_tmp->altitude = be_read32(&rec->elevation); 
 
index 6d632831d9701610f5699fb0cc035433bfe89dd2..55e73bd7670771bf0678e7f9b5ad8ace45d0928b 100644 (file)
@@ -157,7 +157,7 @@ decode(char *buf)
                edata = (char *) rec + pdb_rec->data_len;
 
                for (; vdata < edata; rec = (struct record *) vdata) {
-                       wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
+                       wpt_tmp = waypt_new();
                        wpt_tmp->latitude = Lat1 + 
                                be_read16(&rec->lat1d) / LATDIV2; 
                        wpt_tmp->longitude = Lon1 + 
index b5c2879a9ad358a44c6c57c33eeb3840c247c3a4..0a70623378c9538ef365c95a2e549181ce90ccb2 100644 (file)
@@ -125,7 +125,7 @@ mapsend_wpt_read(void)
        my_fread4(&wpt_count, mapsend_file_in);
        
        while (wpt_count--) {
-               wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
+               wpt_tmp = waypt_new();
 
                if (fread(&scount, sizeof(scount), 1, mapsend_file_in) < 1) {
                        fatal(MYNAME ": out of data reading %d waypoints\n",
@@ -183,7 +183,7 @@ mapsend_wpt_read(void)
                my_fread4(&wpt_count, mapsend_file_in);
                
                while (wpt_count--) {
-                       wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
+                       wpt_tmp = waypt_new();
 
                        /* waypoint name */
                        fread(&scount, sizeof(scount), 1, mapsend_file_in);
@@ -259,7 +259,7 @@ mapsend_track_read(void)
                        centisecs = 0;
                }
 
-               wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
+               wpt_tmp = waypt_new();
                wpt_tmp->latitude = -wpt_lat;
                wpt_tmp->longitude = wpt_long;
                wpt_tmp->creation_time = time;
index 27a04ae9b208dcda1d5d772baab0ced42d44d614..132c1690d7219c59f291e9960cc382776471b2c2 100644 (file)
@@ -94,7 +94,7 @@ data_read(void)
                                &symnum);
                        desc[sizeof(desc)-1] = '\0';
                        name[sizeof(name)-1] = '\0';
-                       wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
+                       wpt_tmp = waypt_new();
                        wpt_tmp->altitude = alt;
                        wpt_tmp->shortname = xstrdup(name);
                        wpt_tmp->description = xstrdup(desc);
index 3fee4ab8b60c7347490a15d0966bbf6f1fd3995b..c621be61ea3fbd1aab3fbe40de7e62ad1e598781 100644 (file)
@@ -215,7 +215,7 @@ psp_read(void)
        pincount = le_read16(&buff[12]);
 
        while (pincount--) {
-           wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
+           wpt_tmp = waypt_new();
 
             wpt_tmp->altitude = unknown_alt;
             
index f723a8951e4b582d26caf826bae7bad52a43b13f..b00699f0dd51284ddc7f3e8c0efb853d7f62f864 100644 (file)
@@ -136,7 +136,7 @@ data_read(void)
        while (fgets(ibuf, sizeof(ibuf), file_in)) {
                if( sscanf(ibuf, "%lf,%lf:%100[^:]:%100[^\n]", 
                                &lon, &lat, icon, desc)) {
-                       wpt_tmp = xcalloc(sizeof (*wpt_tmp), 1);
+                       wpt_tmp = waypt_new();
 
                        wpt_tmp->longitude = lon;
                        wpt_tmp->latitude = lat;
index 708dd9abd678e864a7e2a0265d54e7accac0294e..2e1ed9a985f23593d0c48c9b66a78ebc057de666 100644 (file)
@@ -84,7 +84,7 @@ data_read(void)
        /* skip the line if it contains "sHyperLink" as it is a header (I hope :) */
        if ((strlen(buff)) && (strstr(buff, "sHyperLink") == NULL)) {
 
-           wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
+           wpt_tmp = waypt_new();
 
            /* data delimited by tabs, not enclosed in quotes.  */
            s = buff;
index 9eb3696b593bcc474ad4bb90f03b303383b74267..e12807d86774c0bfd47af5facd7508d20475ec5c 100644 (file)
@@ -135,7 +135,7 @@ tpg_read(void)
         
         
        while (pointcount--) {
-           wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
+           wpt_tmp = waypt_new();
 
             /* 1 bytes at start of record - string size for shortname */
            tpg_fread(&buff[0], 1, 1, tpg_file_in);